#!/sbin/openrc-run

: "${calico_user:=pounce}"
: "${calico_group:=pounce}"
: "${calico_hostname:=localhost}"
: "${calico_dir:=/run/$calico_user}"

name="calico"
description="dispatch incoming TLS connections to pounce by SNI"
command=/usr/bin/calico
command_args="-H $calico_hostname $calico_dir"
[ -n "$calico_port" ] && command_args="$command_args -P $calico_port"
[ -n "$calico_timeout" ] && command_args="$command_args -t $calico_timeout"
command_background=true
command_user="${calico_user}:${calico_group}"
pidfile="/run/${RC_SVCNAME}.pid"

depend() {
    need localmount net
    use dns
}
